#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;
int n,t;
int main(void){
    scanf("%d",&t);
    while(~scanf("%d",&n)){
        int ans=0;
        while(n>0){
            if(n%2){
                ans++;
                n--;
            }
            n/=2;
        }
        printf("%d\n",ans);
    }
    return 0;
}